package io.rehuo.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.rehuo.modules.app.dao.SmsSendLogDao;
import io.rehuo.modules.app.entity.SmsSendLogEntity;
import io.rehuo.modules.app.service.SmsSendLogService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author shiguang on 2022/9/16 16:27
 */
@Service("smsSendLog")
public class SmsSendLogServiceImpl extends ServiceImpl<SmsSendLogDao, SmsSendLogEntity> implements SmsSendLogService {

    @Async
    @Override
    public void asyncSaveSendLog(String type, String companyName,String content, String mobile, Boolean result) {
        SmsSendLogEntity entity = new SmsSendLogEntity();
        entity.setMobile(mobile);
        entity.setContent(content);
        entity.setStatus(result ? "2" : "0");
        entity.setType(type);
        entity.setCreateTime(new Date());
        entity.setCompanyName(companyName);
        baseMapper.insert(entity);
    }
}
